package Lambda;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

/**
 * @Author Justin Parker
 * @Date 2024/7/15 0015 14:42
 * @Version 1.0
 */
public class LambdaDemo02 {

    public static void main(String[] args) {

        List<Integer> list = new ArrayList<>();

        Random r =new Random();
        for (int i=0;i<10;i++){
            list.add(r.nextInt(100)+1);
        }

        Collections.sort(list,(n1,n2)->n1-n2);
        System.out.println(list);

        Collections.reverse(list);
        System.out.println(list);
        }
    }

